let express = require('express');
let router = express.Router();
//————————————连接数据库——————————
var mysql = require('mysql');
var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'password',
    database: 'bookshop'
});

const multer = require('multer');
const upload = multer({ dest: 'uploads/' }); // Set the destination folder for uploaded files

connection.connect((err) => {
    if (err) {
        console.log(err)
    }

});

//获取客户端数据
router.post('/', upload.single('file'), (req, res) => {
    // Handle file upload
    console.log(req.session.token)
    console.log(req.file); // Information about the uploaded file
    res.send('File uploaded successfully!');
  });
module.exports = router;
